package 多线程.状态.阻塞线程;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 休眠不释放锁
 * 1、用于与时间相关
 * 2、模拟网络延迟
 *
 */
public class Sleep {
    //倒计时
    public static void main(String[] args) throws InterruptedException {
        Date endTime = new Date(10*1000);
        long end = endTime.getTime();
        while(true){
            System.out.println(new SimpleDateFormat("mm:ss").format(endTime));
            endTime  = new Date(endTime.getTime()-1000);
            Thread.sleep(1000);
            if((end-10000)>endTime.getTime()){
                break;
            }
        }
    }
}
